﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using AudioPlayer.Database;
using AudioPlayer.Entity;
using AudioPlayer.Plugin.Storage;
namespace AudioPlayer.GUI.List {
	internal class ListItem  {
		#region Fields
		private bool _checked;
		private bool _selected;
		private bool _visible;
		private bool _hover;
		private bool _even;

		private int _index;

		private ISong _song;
		private Rectangle _bounds;
		private ListItem _next;
		private ListItem _prev;

		private ListCollection _parent;
		#endregion
		#region Constructor
		public ListItem(ISong s) {
			this.Song = s;
		}
		#endregion
		#region Private Voids
		
		#endregion
		#region Static Cast

		#endregion
		#region Property
		/// <summary>
		/// Gets or sets the song.
		/// </summary>
		/// <value>The song.</value>
		public ISong Song {
			get { return _song; }
			set { _song=value; }
		}
		/// <summary>
		/// Gets or sets zero based index.
		/// </summary>
		/// <value>The index.</value>
		public int Index {
			get { return _index; }
			set {
				_index = value;
				string ind = _index.ToString();
				if (!string.IsNullOrEmpty(ind)) {
					if (ind.EndsWith("0") ||
						ind.EndsWith("2") ||
						ind.EndsWith("4") ||
						ind.EndsWith("6") ||
						ind.EndsWith("8")) {
						_even = true;
					} else {
						_even = false;
					}
				} else {
					_even = true;
				}
			}
		}

		/// <summary>
		/// Gets or sets a value indicating whether this item is checked.
		/// </summary>
		/// <value><c>true</c> if checked; otherwise, <c>false</c>.</value>
		public bool Checked {
			get { return _checked; }
			set {_checked = value; }
		}
		/// <summary>
		/// Gets or sets a value indicating whether this item is selected.
		/// </summary>
		/// <value><c>true</c> if selected; otherwise, <c>false</c>.</value>
		public bool Selected {
			get { return _selected; }
			set { _selected = value; }
		}
		/// <summary>
		/// Gets or sets a value indicating whether this item is visible
		/// </summary>
		/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
		public bool Visible {
			get { return _visible; }
			set { _visible = value; }
		}
		/// <summary>
		/// Gets or sets if mouse is over
		/// </summary>
		/// <value><c>true</c> if mouse is over; otherwise, <c>false</c>.</value>
		public bool Hover {
			get { return _hover; }
			set { _hover = value; }
		}

		/// <summary>
		/// Gets a value indicating whether this <see cref="ListItem"/> is even.
		/// </summary>
		/// <value><c>true</c> if even; otherwise, <c>false</c>.</value>
		public bool Even {
			get { return _even; }
		}

		/// <summary>
		/// Gets or sets the prev item.
		/// </summary>
		/// <value>The prev.</value>
		public ListItem Prev {
			get { return _prev; }
			set { _prev=value; }
		}
		/// <summary>
		/// Gets or sets the next item.
		/// </summary>
		/// <value>The next.</value>
		public ListItem Next {
			get { return _next; }
			set { _next=value; }
		}

		/// <summary>
		/// Gets or sets the bounds of item.
		/// </summary>
		/// <value>The Rectangle.</value>
		public Rectangle Bounds {
			get { return _bounds; }
			set { _bounds = value; }
		}

		/// <summary>
		/// Gets or sets the parent.
		/// </summary>
		/// <value>The parent.</value>
		public ListCollection Parent {
			get { return _parent; }
			set { _parent = value; }
		}
		#endregion
	}
}
